<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" http-equiv="content-type" content="text/html">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>搜索</title>

<link href="css/jquery.mobile-1.4.5.min.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="css/mybuy.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/u-header.css"/>
<link rel="stylesheet" type="text/css" href="css/mylike.css"/>
<link rel="stylesheet" type="text/css" href="css/need/layer.css"/>
<script type="text/javascript" src="js/layer.js"></script>
<script>
$(document).bind('mobileinit',function(){
 $.mobile.changePage.defaults.changeHash = false;
 $.mobile.hashListeningEnabled = false;
 $.mobile.pushStateEnabled = false;
});
</script>
<script src="js/jquery.mobile-1.4.5.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="mybuy">
 	<div data-role="content" id="content">
 	</div>
 </div>
</body>
<script type="text/javascript">
var isLast = false;
$(document).ready(function() { 
	getSearchThingList(1,'${searchKey}');
}); 
//加载本人的闲置列表
function getSearchThingList(pageNum,searchKey){
	if(isLast == false){
		var url = "api/index/search.do";
		$.post(url,{pageNum:pageNum,pageSize:10,searchKey:searchKey,catagoryId:'${catagoryId}'},
		function(data){
			if(data["STATUS"]=="OK"){
				if(data["RESULTLIST"]==null){
					layer.open({
					    content: '没有更多了'
					    ,btn: '我知道了'
					  });
					return ;
				}
				var resultListJson = eval("("+data["RESULTLIST"]+")");
				var html= '';
				$.each(resultListJson,function(keyDaily,valueDaily){
					
					html+='<div class="mylike-c">';
					html+='<div class="user">';
					html+='<div class="face">';
					html+='<a href="api/myself/userInfo.do?USERID='+valueDaily.USERID+'">';
					html+='<img src="'+valueDaily.USERHEADIMG+'"/>';
					html+='</a>';
					html+='</div>';
					html+='<div class="u-detail">';
					html+='<div class="u-info">';
					html+='<a href="javascript:void(0)">'+valueDaily.NICKNAME+'</a>';
					html+='<img src="images/g'+(valueDaily.LEVEL+1)+'.png" />';
					html+='<a href="javascript:void(0)">';
					html+='</a>';
					html+='</div>';
					html+='<span>'+valueDaily.TIME+'</span>';
					html+='</div>	';
					html+='<div class="price">';
					html+='<span class="new-p">'+valueDaily.PRICE+'</span>';
					html+='<span class="old-p">'+valueDaily.OLDPRICE+'</span>';
					html+='</div>		';
					html+='</div>';
					html+='<div class="text">';
						
					html+='<p>'+valueDaily.TITLE+'</p>	';			
					html+='</div>';

					if(valueDaily.IMG!=''){
						var img = valueDaily.IMG.split(',');
						html+='<div class="pic">';
						for(var ii=0;ii<img.length;ii++){
							if(ii>2){
								break;
							}
							html+='<img src="'+img[ii]+'"/>';
						}
						html+='</div>';
					}

					html+='<div class="bottom">';
					html+='<a class="assess" href="javascript:void(0)">'+valueDaily.COMMENTNUM+'</a>';
					html+='<a class="like" href="javascript:void(0)">'+valueDaily.LIKE+'</a>';
					html+='</div>';
					html+='</div>';
					
				});
				isLast = data["isLast"];
				$("#content").append(html);
			}
		},'json');
	}
}

</script>
</html>